#ifndef CZENFRAME_H
#define CZENFRAME_H

#include "ZenObject.h"

#define STOP 0//DON't touch this!!!
#define UP 1//DON't touch this!!!
#define DOWN 2//DON't touch this!!!
#define LEFT 3//DON't touch this!!!
#define RIGHT 4//DON't touch this!!!

class CZenFrame;
typedef int (*FRAME_MOVEMENT_CALLBACK)(CZenFrame * pFrame, void * Parameter);

class CZenFrame
{
public:
	CZenFrame();
	virtual ~CZenFrame();

	void SetNext(CZenFrame * pNext);
	CZenFrame * GetNext();

	HRESULT AddFrame(CZenFrame * pNewFrame);
	HRESULT AddFrame(CZenFrame & NewFrame);

	HRESULT DeleteFrame(CZenFrame * pOldFrame);
	HRESULT DeleteFrame(CZenFrame & OldFrame);

	HRESULT SetCallback(FRAME_MOVEMENT_CALLBACK pfnCallback);

	void SetVelocity(float x, float y, float z);
	void GetVelocity(float &x, float &y, float &z);

	virtual void SetPosition(float x, float y, float z);
	void GetPosition(float &x, float &y, float &z);

	void SetYaw(float Yaw);
	void GetYaw(float &Yaw);
	
	void SetPitch(float Pitch);
	void GetPitch(float &Pitch);
	
	void SetRoll(float Roll);
	void GetRoll(float &Roll);
	
	void Update();
	void GetLocal(D3DXMATRIX &pMatrix);
	
	HRESULT AddObject(CZenObject * pNewObject);
	HRESULT AddObject(CZenObject & pNewObject);

	HRESULT Render();
	
	CZenEngine	zen;

	void * m_pParameter;
	
protected:
	D3DXMATRIX	 m_mLocal;
	D3DXVECTOR3	 m_vPosition;
	D3DXVECTOR3	 m_vVelocity;
	
	float		 m_Yaw, m_Pitch, m_Roll;
	CZenObject * m_pObjectList;		
	
	CZenFrame * m_pNext;
	CZenFrame * m_pChildFrameList;
	CZenFrame * m_pParentFrame;
	
	FRAME_MOVEMENT_CALLBACK m_pfnCallback;
	BOOL m_bCallback;
	
protected:
	void SetParent(CZenFrame * pParent);
	CZenFrame * GetParent();
};

#endif
